' ResEdit.ibas
'   Version 1.01 - December 16, 2005
'   by Laurent Duveau
'     Web Site = http://www.aldweb.com
'     e-Mail   = info@aldweb.com

{CREATORID "LDRE"}
{VERSION "1.0"}
'{MINOSVERSION "3.0"}
'{PARSER OFF}
'{KEYEVENTS OFF}
'{SECUREFILES ON}


'A$ Main variable
CONST B$="1" 'should delete existing ResFile?
CONST C$="1" 'should delete existing String Res?
'D$ Res Data
CONST E$="1" 'should delete existing Bitmap Res?


BEGIN

 ' Manage Resource File
 A$=CALLPP$(100,"0ResDB.rsrc")
 PRINT "ResDB.rsrc exist? => "; : PRINT A$
 A$=A$+B$
 IF A$="11" THEN
  A$=CALLPP$(100,"1ResDB.rsrc")
  PRINT "ResDB.rsrc deleted? = "; : PRINT A$
 END IF
 A$=CALLPP$(100,"2RsrcRscEResDB.rsrc")
 PRINT "ResDB.rsrc created? => "; : PRINT A$
 WAIT : CLS

 ' Manage a String resource
 A$=CALLPP$(100,"3tSTR0100ResDB.rsrc")
 PRINT "Res tSTR 100 registered? => "; : PRINT A$
 IF A$="1" THEN
  A$=CALLPP$(100,"4")
  PRINT "Res tSTR 100 exist? => "; : PRINT A$
  A$=A$+C$
  IF A$="11" THEN
   A$=CALLPP$(100,"5")
   PRINT "Res tSTR 100 deleted? => "; : PRINT A$
  END IF
  D$="My first Important Data"+CHR$(10)
  D$="60001"+D$
  A$=CALLPP$(100,D$)
  PRINT "Res tSTR 100 created? => "; : PRINT A$
  D$="My second Important Data"
  D$="60025"+D$
  A$=CALLPP$(100,D$) 
  PRINT "Res tSTR 100 appended? => "; : PRINT A$
  A$=CALLPP$(100,"80001")
  PRINT "Content in Res tSTR 100 :" : PRINT A$
 END IF
 WAIT : CLS
 
 ' Manage a Bitmap resource, the hard way (binary create!)
 A$=CALLPP$(100,"3Tbmp0100ResDB.rsrc")
 PRINT "Res Tbmp 100 registered? => "; : PRINT A$
 IF A$="1" THEN
  A$=CALLPP$(100,"4")
  PRINT "Res Tbmp 100 exist? => "; : PRINT A$
  A$=A$+E$
  IF A$="11" THEN
   A$=CALLPP$(100,"5")
   PRINT "Res Tbmp 100 deleted? => "; : PRINT A$
  END IF
  D$="60002"+CHR$(8) : A$=CALLPP$(100,D$)
  D$="60004"+CHR$(8) : A$=A$+CALLPP$(100,D$)
  D$="60006"+CHR$(2) : A$=A$+CALLPP$(100,D$)
  D$="60009"+CHR$(1) : A$=A$+CALLPP$(100,D$)
  D$="60010"+CHR$(2) : A$=A$+CALLPP$(100,D$)
  D$="60014"+CHR$(255) : A$=A$+CALLPP$(100,D$)
  D$="60017"+CHR$(255) : A$=A$+CALLPP$(100,D$)
  D$="60019"+CHR$(131) : A$=A$+CALLPP$(100,D$)
  D$="60021"+CHR$(165) : A$=A$+CALLPP$(100,D$)
  D$="60023"+CHR$(137) : A$=A$+CALLPP$(100,D$)
  D$="60025"+CHR$(145) : A$=A$+CALLPP$(100,D$)
  D$="60027"+CHR$(165) : A$=A$+CALLPP$(100,D$)
  D$="60029"+CHR$(193) : A$=A$+CALLPP$(100,D$)
  D$="60031"+CHR$(255) : A$=A$+CALLPP$(100,D$)
  D$="60032"+CHR$(0) : A$=A$+CALLPP$(100,D$)
  PRINT "Res Tbmp 100 created? => ";
  IF A$="111111111111111" THEN
   PRINT "1"
  ELSE
   PRINT "0"
  END IF
  A$=CALLPP$(100,"9080002")
  PRINT "Tbmp 100 displayed => "; : PRINT A$
 END IF
 WAIT : CLS
 
 ' Manage a Bitmap resource, the easy way (copy from existing one)
 A$=CALLPP$(100,"3Tbmp0200ResDB.rsrc")
 PRINT "Res Tbmp 200 registered? => "; : PRINT A$
 IF A$="1" THEN
  A$=CALLPP$(100,"4")
  PRINT "Res Tbmp 200 exist? => "; : PRINT A$
  A$=A$+E$
  IF A$="11" THEN
   A$=CALLPP$(100,"5")
   PRINT "Res Tbmp 200 deleted? => "; : PRINT A$
  END IF
  A$=CALLPP$(100,"70035iziBasic")
  PRINT "Res Tbmp 200 loaded => "; : PRINT A$
  A$=CALLPP$(100,"9100002")
  PRINT "Tbmp 200 displayed => "; : PRINT A$
 END IF
 WAIT

END
